package com.miracle.main.module.mvp.model;

import com.miracle.basemvp.base.BaseModel;
import com.miracle.basemvp.base.BaseResponse;
import com.miracle.basemvp.lifecycle.rx.RxSchedulersHelper;
import com.miracle.basemvp.network.IRetrofitManager;
import com.miracle.common.mvp.entity.response.BaseListResponse;
import com.miracle.main.module.api.MainApi;
import com.miracle.main.module.mvp.contract.FileListContract;
import com.miracle.main.module.mvp.entity.bean.FileItem;
import com.miracle.main.module.mvp.entity.request.FileListRequest;

import java.util.ArrayList;

import javax.inject.Inject;

import io.reactivex.Observable;

/**
 * com.miracle.main.module.mvp.model
 * (c)2018 AIR Times Inc. All rights reserved.
 *
 *
 * @author WangJQ
 * @version 1.0
 * @date 2018/7/11 10:18
 * @see com.miracle.main.module.mvp.model
 */
public class FileListModel extends BaseModel implements FileListContract.Model {

    @Inject
    public FileListModel(IRetrofitManager retrofitManager) {
        super(retrofitManager);
    }

    @Override
    public Observable<BaseResponse<BaseListResponse<FileItem>>> getFileList(FileListRequest request) {
        return mRetrofitManager
                .obtainRetrofitService(MainApi.class)
                .getFileList(request)
                .compose(RxSchedulersHelper.<BaseResponse<BaseListResponse<FileItem>>>io_main());
    }
}
